package com.jy.unkown.view;

import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.jy.common.BaseApplication;

public class CusWebViewClient extends WebViewClient {

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        if (!TextUtils.isEmpty(url)) {
            if (!url.startsWith("http")) {
                //deeplink 跳转
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse(url));
                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                BaseApplication.getBaseApplication().startActivity(intent);
                return true;
            }
        }


        view.loadUrl(url);
        return true;
    }
}
